<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3D盒子</title>
    <style>
        html
        {
            background: -webkit-radial-gradient(center, ellipse, #430d6d 0%, #000000 100%);
            background: radial-gradient(ellipse at center, #430d6d 0%, #000000 100%);
            height: 100%;
        }
        #box{
            perspective: 990px;
            width: 350px;
            height: 350px;
            margin: 100px auto;
        }
        #box .cube{
            transform-style: preserve-3d;
            transform-origin: center center -150px;
            animation:rot 10s infinite linear;
            position: relative;
            width: 100%;
            height: 100%;
        }
        .cube div{
            position: absolute;
            left: 0;
            top: 0;
            width: 355px;
            height: 354px;
            text-align: center;
            line-height: 355px;
            font-size: 22px;
            color: #fff;
            /* border: 1px solid #ccc; */
            background: -webkit-linear-gradient( left, rgba(54, 226, 248, 0.5) 0px, rgba(54, 226, 248, 0.5) 3px, rgba(0, 0, 0, 0) 0px), -webkit-linear-gradient( top, rgba(54, 226, 248, 0.5) 0px, rgba(54, 226, 248, 0.5) 3px, rgba(0, 0, 0, 0) 0px);
            background-size: 2em 2em;

        }
        .cube div:nth-child(1){
        }
        .cube div:nth-child(2){
            /*transform-origin:;*/
            transform:translateZ(-360px);
        }
        .cube div:nth-child(3){
            transform-origin: left;
            transform: rotateY(90deg);
        }
        .cube div:nth-child(4){
            transform-origin: right;
            transform: rotateY(-90deg);
        }
        .cube div:nth-child(5){
            transform-origin: top;
            transform: rotateX(-90deg);
        }
        .cube div:nth-child(6){
            transform-origin: bottom;
            transform: rotateX(90deg);
        }
        @keyframes rot {
            to{
                transform:rotateY(360deg) rotateX(360deg);
            }
        }
    </style>
</head>
<body>
<div id="box">
    <div class="cube">
        <div>前</div>
        <div>后</div>
        <div>左</div>
        <div>右</div>
        <div>上</div>
        <div>下</div>
    </div>
</div>
</body>
</html>